# -*- coding: utf8-*-
from __future__ import print_function
import json
import requests

xinlang_url = "http://api.t.sina.com.cn/short_url/shorten.json?source=3271760578"


def xinlang_surl(surl):
    data = {"url_long": surl}
    content = requests.get(url=xinlang_url, params=data)
    # print content.content
    xx = json.loads(content.content)
    return xx[0]["url_short"]


s_url = "http://www.baidu.com"
x = xinlang_surl(s_url)
print(x)
